package com.baidu.bulls.stock.trade.oauth.startup;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

/**
 * <p>Description: </p>
 * @date 
 * @author 
 * @version 1.0
 * <p>Copyright:Copyright(c)2020</p>
 */
@SpringBootApplication
@EnableDiscoveryClient
@ComponentScan(basePackages = {"com.baidu"})
@EntityScan(basePackages = {"com.baidu"})
@EnableJpaRepositories(basePackages =  {"com.baidu"})
@EnableCaching //oauth2集成缓存
public class TradeAuthApplication {

    public static void main(String[] args) {
        SpringApplication.run(TradeAuthApplication.class, args);
    }
/**
 * 延迟双删
 *      1。修改数据前先删除缓存，更新成功后，过0.5s删除
 *      2.查到数据时没有缓存，数据库还没更新，然后写入到缓存中，此时数据库刚更新好，会导致脏数据
 *      3.可能会导致连接数过多，我们可以用kafka解决
 *      4.设置redis过期时间
 *      5.使用binlog日志解析更新内容，在更新到redis
 *
 */
}
